package com.up.stores.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.up.stores.entity.Request;
import com.up.stores.entity.User;

import java.util.Date;
import java.util.List;

public interface RequestMapper extends BaseMapper<Request> {
    /*插入关联申请*/
    Integer insertRequest(Request request);

    /*根据reqId查询申请*/
    Request findByReqId(Integer reqId);

    /*根据admId查询申请*/
    List<Request> findByAdmId(Integer admId);

    /*根据norId查询申请*/
    List<Request> findByNorId(Integer norId);

    /*根据norId查询该记录的admId字段值是否为空,若为空则查找不到该记录，反之*/
    User findAdmIdByNorId(Integer norId);

    /*根据nodId查找记录并将其admId字段值置空*/
    Integer updateAdmIdByNorId(Integer norId);

    /*根据admId和reqStatus查询归属于某管理员的不同状态的申请*/
    List<Request> findByAdmNameAndReqStatus(String admName, Integer reqStatus);

    /*更新申请状态*/
    Integer updateStatusByReqId(Integer reqId, Integer reqStatus, String modifiedUser, Date modifiedTime);
}
